package cn.hx.whh.automaticticket;

import android.app.Application;
import android.widget.Toast;

import cn.hx.whh.automaticticket.listener.ActivityLifecycleListener;
import cn.hx.whh.automaticticket.pool.PrintThreadPoolExecutor;

public class AutomaticTicketApplication extends Application {
    private static final String TAG = "AutomaticTicketActivity";
    public static AutomaticTicketApplication mApp;

    @Override
    public void onCreate() {
        super.onCreate();
        registerActivityLifecycleCallbacks(new ActivityLifecycleListener());// 追加运行监听器
        // PrintThreadPoolExecutor.getInstance(); // 注册打印线程池
        configUncaughtExceptionHandler();
        mApp = this;
        // SystemUiUtils.setStickFullScreen(getWindow().getDecorView());  // 全屏化 Activity
    }
    /**
     * 捕获异常
     */
    private void configUncaughtExceptionHandler() {
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable ex) {
                Toast.makeText(AutomaticTicketApplication.this, "crash", Toast.LENGTH_LONG).show();
                ex.printStackTrace();
            }

        });
    }
}
